package de.fhin.mas.agents.gripper.behaviours;

import jade.core.Agent;
import jade.core.behaviours.OneShotBehaviour;
import de.fhin.mas.agents.gripper.GripperAgent;

public class MoveGripperPutDown extends OneShotBehaviour {

	private static final long serialVersionUID = -5907553416821462185L;

	private final GripperAgent gripperAgent;
	private final MoveGrapplerToStandbyPosition toStandby;
	private final MoveGrapplerToTransportPosition toTransport;

	public MoveGripperPutDown(Agent superAgent, MoveGrapplerToStandbyPosition toStandby, MoveGrapplerToTransportPosition toTransport) {
		super(superAgent);
		gripperAgent = (GripperAgent) superAgent;
		this.toStandby = toStandby;
		this.toTransport = toTransport;
	}

	/** Das Objekt wird abgelegt */
	public void moveGripper() {
		gripperAgent.printLn("Unloading object");
		gripperAgent.setGrapplerStatus("PUTDOWN");
		try {
			Thread.sleep(1000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
		toStandby.action();
	}

	@Override
	public void action() {
		moveGripper();
	}

	@Override
	public int onEnd() {
		return 0;
	}
}
